package com.neutech.service.impl;

import com.neutech.mapper.DrugMapper;
import com.neutech.service.DrugService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class DrugServiceImpl implements DrugService {
    @Autowired
    private DrugMapper drugMapper;
    @Override
    public List<Map<String ,Object>> queryDrugByName(String name){
        return drugMapper.queryDrugByName(name);
    }

    @Override
    public void deldrug(Integer code) {
        drugMapper.deldrugbycode(code);
    }

    @Override
    public List<Map<String, Object>> querydrugcode(Integer code) {
        return drugMapper.querydrugbycode(code);
    }

    @Override
    public List<Map<String, Object>> querydruglist() {
        return drugMapper.querydruglist();
    }

    @Override
    public void adddrug(Map<String, Object> map) {
        for(Object Key : map.keySet())
        {
            Object value = map.get(Key);
            map.put((String) Key,value);
        }
        drugMapper.adddrug(map);
    }
}
